#pragma once

#include "CThread.h"
#include "CJob.h"
#include "CThreadPool.h"
#include "CThreadSem.h"

class CThread;
class CThreadPool;
class CJob;
//class CThreadMutex;
//class CCondition;

class CWorkerThread:public CThread
{
private:
  CThreadPool* m_ThreadPool;
  CJob*  m_Job;
  void*  m_JobData;
  
  //CThreadMutex m_varMutex;
  //bool  m_IsEnd;

public:
  //CCondition m_JobCond;
  //CThreadMutex  m_WorkMutex;
  CThreadSem  *m_lpJobSem;
  
  CWorkerThread(bool bDetach = true);
  virtual ~CWorkerThread();
  void Run();
  void SetJob(CJob* job, void* jobdata);
  CJob* GetJob(){return m_Job;}
  void SetThreadPool(CThreadPool* thrpool);
  CThreadPool* GetThreadPool(){return m_ThreadPool;}
		
};